import java.awt.event.*;
import java.awt.*;
/**
 * La clase JogMode permite el control manual del movimiento 
 * de la herramienta mediante los botones de avance constante.
 * Contiene además contoles para variar la velocidad de avance,
 * movimiento dirección y velocidad del husillo y contolar el 
 * comportamiento de los dispositivos.
 */
public class JogMode extends Mode
{
    public JogMode()
    {
        super(
            "jogMode",
            KbdCmdId.CmdValue.MODE_JOG
        );
    }
    public void setDescriptionViewPanel()
    {
        addTopPanels(
            "emergencyStop",
            Mode.Place.NORTH,
            new GridBagConstraints(
                1,
                0,
                1,
                1,
                0,
                0,
                GridBagConstraints.EAST,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.EMERGENCY_STOP},
            null
        );
        addTopPanels(
            "operationMode",
            Mode.Place.NORTH,
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.OPERATION_MODE},
            null
        );
        addTopPanels(
            "targetPosition",
            Mode.Place.CENTER,
            new GridBagConstraints(
                0,
                1,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.ATP},
            null
        );
        addTopPanels(
            "state",
            Mode.Place.CENTER,
            new GridBagConstraints(
                2,
                0,
                1,
                3,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.AXIS_LIMIT_SWITCH},
            null
        );
        addTopPanels(
            "currentPosition",
            Mode.Place.CENTER,
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.AXIS_CURRENT_POSITION},
            null
        );
        addTopPanels(
            "motionTravelRange",
            Mode.Place.CENTER,
            new GridBagConstraints(
                1,
                0,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.AXIS_MOTION_TRAVEL_RANGE},
            null
        );
        addTopPanels(
            "spindle",
            Mode.Place.CENTER,
            new GridBagConstraints(
                0,
                2,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.SPINDLE},
            null
        );
        addTopPanels(
            "devices",
            Mode.Place.CENTER,
            new GridBagConstraints(
                1,
                1,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.DEVICES},
            null
        );
        addTopPanels(
            "feedrate",
            Mode.Place.CENTER,
            new GridBagConstraints(
                1,
                2,
                1,
                1,  
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.FEEDRATE},
            null
        );
    }
    public void setDescriptionEditablePanel()
    {
        addBottomPanels(
            "axisMotion",
            Mode.Place.CENTER,
            new Data.Id[] {
                Data.Id.JOG_FEEDRATE,
                Data.Id.JOG_FEEDRATE_OVERRIDE,
                Data.Id.JOG_AXES
            },
            new AnotherComponent[] {
                AnotherComponent.PANEL
            },
            null//new FlowLayout()
        );
        addBottomPanels(
            "spindle",
            Mode.Place.CENTER,
            new Data.Id[] {
                Data.Id.SPINDLE_DIRECTION,
                Data.Id.SPINDLE_MOTION,
                Data.Id.SPINDLE_SPEED_OVERRIDE,
                Data.Id.OTHER,
                Data.Id.OTHER,
                Data.Id.OTHER
            },
            new AnotherComponent[] {
                AnotherComponent.PANEL,
                AnotherComponent.PANEL,
                AnotherComponent.PANEL
            },
            new GridLayout(2,3)
        );
        addBottomPanels(
            "devices",
            Mode.Place.CENTER,
            new Data.Id[] {
                Data.Id.DEVICES,
                Data.Id.OTHER
            },
            new AnotherComponent[] {
                AnotherComponent.PANEL
            },
            new GridLayout(2,1)
        );
    }
}
